
import matplotlib.pyplot as plt
import get_metric
plt.rcParams['font.sans-serif'] = ['Times New Roman']
plt.rcParams.update({"font.size":20})


if __name__ == "__main__":
    # time_list, throughput_list = get_metric.get_throughput_list('cubic_md20_100Mb_lat40ms_uplinkloss1%.pcap.csv', 1000, 0.04)
    # time_list, throughput_list = get_metric.get_throughput_list('cubic_md5_100Mb_lat10ms_uplinkloss1%.pcap.csv', None, 0.01)
    # time_list, throughput_list = get_metric.get_throughput_list('cubic_md5_100Mb_lat10ms.pcap.csv', None, 0.01)
    time_list, throughput_list = get_metric.get_throughput_list('cubic_md20_10Mb_lat40ms_uplinkloss1%_iperf30s.pcap.csv', None, 0.01)
    m_time_list, m_throughput_list = get_metric.get_throughput_list('mcubic_md20_10Mb_lat40ms_uplinkloss1%_iperf30s.pcap.csv', None, 0.01)
    
    plt.figure(figsize=(6, 3))
    plt.plot(time_list, throughput_list, label = 'CUBIC')
    plt.plot(m_time_list, m_throughput_list, label = 'mCUBIC')
    plt.xlabel('Time (s)')
    plt.ylabel('Throughput (Bytes/s)')
    plt.grid()
    plt.legend(bbox_to_anchor=(0.5, 0.6))
    plt.tight_layout()
    file_name = __file__.split('/')[-1].split('.')[0]
    plt.savefig(f"{file_name}.pdf", bbox_inches='tight')
    plt.show()

